package DMSXL._2023Before.Array;

/*public class minSubArrayLen_ {
    public static void main(String[] args) {
        Solution solution1 = new Solution();
        int[] nums = {2,3,10};
        int target = 7;
        System.out.println(solution1.minSubArrayLen(target,nums));
    }
}
class Solution {
    public int minSubArrayLen(int s, int[] nums) {
        int left = 0;
        int sum = 0;
        int result = Integer.MAX_VALUE;
        for (int right = 0; right < nums.length; right++) {
            sum += nums[right];
            while (sum >= s) {
                result = Math.min(result,right-left+1);
                sum -= nums[left++];
            }
        }
        return result == Integer.MAX_VALUE ? 0 : result;
    }
}*/